<p>不允许在<code> finally </code>块中使用<code>return</code>，<code> break </code>，<code> continue </code>，<code> throw </code>语句，
  因为这会导致你在<code> try </code>或<code> catch </code>块中抛出的<code> Throwable </code>无法传递给上层。</p>

<h2>不规范的代码示例</h2>
<pre>
public static void main(String[] args) {
  try {
    doSomethingWhichThrowsException();
    System.out.println("OK");   // 打印了不正确的“确定”消息
  } catch (RuntimeException e) {
    System.out.println("ERROR");  // 此消息未显示
  }
}

public static void doSomethingWhichThrowsException() {
  try {
    throw new RuntimeException();
  } finally {
    for (int i = 0; i &lt; 10; i ++) {
      //...
      if (q == i) {
        break; // ignored
      }
    }

    /* ... */
    return;      // 不合规-阻止传播RuntimeException
  }
}
</pre>

<h2>正确的代码示例</h2>
<pre>
public static void main(String[] args) {
  try {
    doSomethingWhichThrowsException();
    System.out.println("OK");
  } catch (RuntimeException e) {
    System.out.println("ERROR");  // 按预期打印“错误”
  }
}

public static void doSomethingWhichThrowsException() {
  try {
    throw new RuntimeException();
  } finally {
    for (int i = 0; i &lt; 10; i ++) {
      //...
      if (q == i) {
        break; // ignored
      }
    }

    /* ... */
  }
}
</pre>

<h2>更多</h2>
<ul>
<li> <a href="http://cwe.mitre.org/data/definitions/584.html">MITRE, CWE-584</a> - Return Inside Finally Block
</li><li> <a href="https://www.securecoding.cert.org/confluence/x/mIEbAQ">CERT, ERR04-J.</a> - Do not complete abruptly from a finally block
</li></ul>

